package com.jsnkj.basic.fragment

import androidx.lifecycle.MutableLiveData
import com.jsnkj.basic.bean.ErrorEntity
import com.jsnkj.basic.bean.IncomeExpenditureListEntity
import com.jsnkj.basic.http.HttpApiService
import com.jsnkj.basic.mvvm.HttpViewModel
import com.yang.http.HttpRequest

class IncomeViewModel : HttpViewModel() {


    var postHttpResult: MutableLiveData<IncomeExpenditureListEntity> = MutableLiveData()

    var errorResult: MutableLiveData<ErrorEntity> = MutableLiveData()

    /**
     * 获取初始化app数据
     */
    fun postWalletIncomes() {

        launchHttp({
            HttpRequest.getService(HttpApiService::class.java).postWalletIncomes()
        }, onResult = { it ->
            com.jsnkj.basic.util.LogUtils.e("请求成功：$it")
            postHttpResult.value = it
        }, onFailed = { code, msg ->
            errorResult.value =ErrorEntity.getInstance(code,msg)

        }) {
            //LogUtils.e("请求成功", "postAppInit onComplete")
        }
    }
}